home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-04
/
ms_sh21s.zip
/
SH210
/
SRC
/
SHOWKEY.C
< prev
next >
Wrap
C/C++ Source or Header
|
1992-12-14
|
2KB
|
67 lines
/* MS-DOS SHELL - Show Scan codes
*
* MS-DOS SHELL - Copyright (c) 1990,1,2 Data Logic Limited.
*
* This code is subject to the following copyright restrictions:
*
* 1. Redistribution and use in source and binary forms are permitted
* provided that the above copyright notice is duplicated in the
* source form and the copyright notice in file sh6.c is displayed
* on entry to the program.
*
* 2. The sources (or parts thereof) or objects generated from the sources
* (or parts of sources) cannot be sold under any circumstances.
*
* $Header: /usr/users/istewart/src/shell/sh2.1/RCS/showkey.c,v 2.0 1992/07/16 14:35:08 istewart Exp istewart $
*
* $Log: showkey.c,v $
* Revision 2.0 1992/07/16 14:35:08 istewart
* Release 2.0
*
*
*/
#include <stdio.h>
#include <unistd.h>
#include <ctype.h>
#include <dos.h>
void main (void)
{
union REGS Key;
union REGS Shift;
puts ("Control C to terminate");
while (TRUE)
{
Key.x.ax = 0;
int86 (0x16, &Key, &Key);
Shift.x.ax = 0x0200;
int86 (0x16, &Shift, &Shift);
printf ("Scan = 0x%.4x ", Key.h.ah);
printf ("ASCII = 0x%.4x (%c) ", Key.h.al, isprint (Key.h.al) ?
Key.h.al : '.');
printf ("Shift = 0x%.4x ( ", Shift.h.al);
if (Shift.h.al & 0x01)
printf ("Right Shift ");
if (Shift.h.al & 0x02)
printf ("Left Shift ");
if (Shift.h.al & 0x04)
printf ("Control ");
if (Shift.h.al & 0x08)
printf ("Alt ");
puts (")");
if (Key.h.al == 0x03)
exit (0);
}
}